package com.bankLogisticsSys.menu;


import com.bankLogisticsSys.util.WeixinUtil;
import com.jfinal.kit.JsonKit;
import com.jfinal.kit.PropKit;
import com.jfinal.weixin.sdk.api.SnsAccessTokenApi;

/**
 * @author Javen
 * @Email javenlife@126.com
 * 菜单管理器类 
 */
public class MenuManager  {
	    
	    //主菜单
	    public static String getMainMenu(){
	    	ClickButton btn11 = new ClickButton();  
	        btn11.setName("派单");  
	        btn11.setType("click");  
	        btn11.setKey("pack");
	  
	        ClickButton btn12 = new ClickButton();  
	        btn12.setName("揽收(分发)");  
	        btn12.setType("click");  
	        btn12.setKey("get");;  
	  
	        ClickButton btn13 = new ClickButton();  
	        btn13.setName("发送");  
	        btn13.setType("click");  
	        btn13.setKey("send");
	        
	        ClickButton btn14 = new ClickButton();
	        btn14.setName("接收");
	        btn14.setType("click");
	        btn14.setKey("receive");
	        
	        ClickButton btn15 = new ClickButton();
	        btn15.setKey("accept");
	        btn15.setName("验收");
	        btn15.setType("click");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan"); 
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish"); 
	  	        
	        ClickButton btn31 = new ClickButton();  
	        btn31.setName("空包退回");  
	        btn31.setType("click");  
	        btn31.setKey("returnPk"); 
	        
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn11, btn31});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] {btn22, btn32, btn33});  
	  
	        Menu menu = new Menu();  
	        menu.setButton(new Button[] { mainBtn1, btn21, mainBtn3 });  
	        String jsonMenu = JsonKit.toJson(menu).toString();
	        return jsonMenu;  
	    }
	    
	    //银行网点菜单
	    public static String getBankSMenu(){
	    	ClickButton btn11 = new ClickButton();  
	        btn11.setName("派单");  
	        btn11.setType("click");  
	        btn11.setKey("pack");
	        
	        ClickButton btn14 = new ClickButton();
	        btn14.setName("验收");
	        btn14.setType("click");
	        btn14.setKey("accept");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan");;  
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish");;  
	          
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn11, btn14});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] {btn22,btn32, btn33});  
	        
	        Matchrule rule = new Matchrule();
	        rule.setTag_id("100");

	        SpecialMenu sMenu = new SpecialMenu();
	        sMenu.setButton(new Button[] { mainBtn1, btn21, mainBtn3 });
	        sMenu.setMatchrule(rule);
	        String jsonMenu = JsonKit.toJson(sMenu).toString();
	        return jsonMenu;   
	    }
	    
	  //银行分行
	    public static String getBankMMenu(){
	    	
	        ClickButton btn13 = new ClickButton();
	        btn13.setName("空包退回");
	        btn13.setType("click");
	        btn13.setKey("returnPk");
	        
	    	ClickButton btn11 = new ClickButton();  
	        btn11.setName("派单");  
	        btn11.setType("click");  
	        btn11.setKey("pack");
	        
	        ClickButton btn14 = new ClickButton();
	        btn14.setName("验收");
	        btn14.setType("click");
	        btn14.setKey("accept");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan"); 
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish");  
	          
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn13,btn14, btn11});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] {btn22,btn32, btn33});  
	        
	        Matchrule rule = new Matchrule();
	        rule.setTag_id("101");

	        SpecialMenu sMenu = new SpecialMenu();
	        sMenu.setButton(new Button[] { mainBtn1, btn21, mainBtn3 });
	        sMenu.setMatchrule(rule);
	        String jsonMenu = JsonKit.toJson(sMenu).toString();
	        return jsonMenu;   
	    }
	    
	    //邮政网点
	    public static String getNetworkMenu(){
	        	  	  
	        ClickButton btn13 = new ClickButton();  
	        btn13.setName("发送");  
	        btn13.setType("click");  
	        btn13.setKey("send");
	        
	        ClickButton btn14 = new ClickButton();
	        btn14.setName("接收");
	        btn14.setType("click");
	        btn14.setKey("receive");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan");;  
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish");;  
	  
	        
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	  
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn14, btn13});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] {btn22,btn32, btn33});  
	  
	        Matchrule rule = new Matchrule();
	        rule.setTag_id("102");

	        SpecialMenu sMenu = new SpecialMenu();
	        sMenu.setButton(new Button[] { mainBtn1, btn21, mainBtn3 });
	        sMenu.setMatchrule(rule);
	        String jsonMenu = JsonKit.toJson(sMenu).toString();
	        return jsonMenu;  
	    }
	    
	    //分拨中心
	    public static String getCenterMenu(){
	        	  	  
	        ClickButton btn13 = new ClickButton();  
	        btn13.setName("发送");  
	        btn13.setType("click");  
	        btn13.setKey("send");
	        
	        ClickButton btn14 = new ClickButton();
	        btn14.setName("接收");
	        btn14.setType("click");
	        btn14.setKey("receive");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan");;  
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish");;  
	  
	        
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	  
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn14, btn13});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] { btn22,btn32, btn33});  
	  
	        Matchrule rule = new Matchrule();
	        rule.setTag_id("103");

	        SpecialMenu sMenu = new SpecialMenu();
	        sMenu.setButton(new Button[] { mainBtn1, btn21, mainBtn3 });
	        sMenu.setMatchrule(rule);
	        String jsonMenu = JsonKit.toJson(sMenu).toString();
	        return jsonMenu;  
	    }
	    
	    //邮政揽投员菜单
	    public static String getPostmanMenu(){
  	  	  
	        ClickButton btn13 = new ClickButton();  
	        btn13.setName("揽收（分发）");  
	        btn13.setType("click");  
	        btn13.setKey("get");
	  
	        ClickButton btn21 = new ClickButton();  
	        btn21.setName("扫码");  
	        btn21.setType("scancode_waitmsg");  
	        btn21.setKey("action_scan");;  
	  
	        ClickButton btn22 = new ClickButton();  
	        btn22.setName("包裹识别");  
	        btn22.setType("scancode_waitmsg");  
	        btn22.setKey("package_distinguish");;  
	 	        
	        ClickButton btn32 = new ClickButton();  
	        btn32.setName("帮助");  
	        btn32.setType("click");  
	        btn32.setKey("help"); 
	  
	        
	        ViewButton btn33 = new ViewButton();  
	        btn33.setName("登录");  
	        btn33.setType("view");  
	        btn33.setUrl("http://fiberkenzo.com/weixin/");  
	        
	        ComButton mainBtn1 = new ComButton();  
	        mainBtn1.setName("物流管理");  
	        mainBtn1.setSub_button(new Button[] { btn13});  
	  
	        ComButton mainBtn2 = new ComButton();  
	        mainBtn2.setName("扫码");  
	        mainBtn2.setSub_button(new Button[] { btn21, btn22 });  
	  
	        ComButton mainBtn3 = new ComButton();  
	        mainBtn3.setName("个人中心");  
	        mainBtn3.setSub_button(new Button[] {btn22,btn32, btn33});  
	  
	        Matchrule rule = new Matchrule();
	        rule.setTag_id("104");

	        SpecialMenu sMenu = new SpecialMenu();
	        sMenu.setButton(new Button[] { btn13, btn21, mainBtn3 });
	        sMenu.setMatchrule(rule);
	        String jsonMenu = JsonKit.toJson(sMenu).toString();
	        return jsonMenu;  
	    }
	    
		public static String oauth() {
			String appId = WeixinUtil.getApiConfig().getAppId();
			String redirectUri = WeixinUtil.urlEncodeUTF8(PropKit.get("domain") + "/");
			String state = System.currentTimeMillis() + "";

			String url = SnsAccessTokenApi.getAuthorizeURL(appId, redirectUri, state, true);
			return url;
		}
}
